#ifndef _CAN_H_
#define _CAN_H_

struct can_fifo_mail_box {
    volatile unsigned int RIR;
    volatile unsigned int RDTR;
    volatile unsigned int RDLR;
    volatile unsigned int RDHR;
};

struct can_tx_mail_box {
    unsigned int TIR;
    unsigned int TDTR;
    unsigned int TDLR;
    unsigned int TDHR;
};

struct can_filter_reg {
    volatile unsigned int FR1;
    volatile unsigned int FR2;
};

struct can_reg {
    volatile unsigned int          MCR;
    volatile unsigned int          MSR;
    volatile unsigned int          TSR;
    volatile unsigned int          RF0R;
    volatile unsigned int          RF1R;
    volatile unsigned int          IER;
    volatile unsigned int          ESR;
    volatile unsigned int          BTR;
    volatile unsigned int          RESERVED0[88];
    struct can_tx_mail_box         sTxMailBox[3];
    struct can_fifo_mail_box       sFIFOMailBox[2];
    volatile unsigned int          RESERVED1[12];
    volatile unsigned int          FMR;
    volatile unsigned int          FM1R;
    volatile unsigned int          RESERVED2;
    volatile unsigned int          FS1R;
    volatile unsigned int          RESERVED3;
    volatile unsigned int          FFA1R;
    volatile unsigned int          RESERVED4;
    volatile unsigned int          FA1R;
    volatile unsigned int          RESERVED5[8];
    volatile struct can_filter_reg sFilterRegister[14];
};

extern volatile struct can_reg *can;

void init_can1(void);

#endif
